This page last changed on Jan 31, 2007 by bowens.
Q: Is there a PutStyles operation?
A: Yes there is, but it is only a pseudo implementation.
Here is the breakdown of how to use it:
Send a POST request to your server instance using this url: localhost:8080/geoserver/wms?request=putstyles
(replace 'localhost' with your server address)
Then the body just has to be the SLD file.
Make sure that the SLD has a NamedLayer where the <Name> is equal to the feature type you want to set the style for. Then in the NamedLayer tag make sure there is a <UserStyle> that has the name of the style you want to use.
Here is a snippit from our basic SLD editor (in javascript) that builds the SLD file before it sends it off:
XML = '<?xml version="1.0" encoding="UTF-8"?>'+"\n";
XML += '<StyledLayerDescriptor version="1.0.0"'+"\n";
XML += ' xmlns:gml="http://www.opengis.net/gml"'+"\n";
XML += ' xmlns:ogc="http://www.opengis.net/ogc"'+"\n";
XML += ' xmlns="http://www.opengis.net/sld">'+"\n";
XML += ' <NamedLayer>'+"\n";
XML += ' <Name>'+featureType+'</Name>'+"\n";
XML += ' <UserStyle>'+"\n";
XML += ' <Name>'+featureType+'_style</Name>'+"\n";
XML += ' <Title>geoserver style</Title>'+"\n";
XML += ' <Abstract>Generated by GeoServer</Abstract>'+"\n";
XML += ' <FeatureTypeStyle>'+"\n";
XML += ' <Rule>'+"\n";
...
...
...
Be warned that the put styles request is not very robust and was designed just for the sld edito
|